package cn.vehicle.domains.vo.res.vehicle;

import cn.vehicle.enums.VehicleTypeEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;

@Data
@Schema(description = "普通车辆查询响应结果")
public class CommonVehicleRes {

    @Schema(name = "id", description = "车辆ID")
    private Long id;

    @Schema(name = "vehicleNumber", description = "车牌号")
    private String vehicleNumber;

    @Schema(name = "vehicleType", description = "车辆类型")
    private String vehicleType;

    @Schema(name = "vehicleTypeDesc", description = "车辆类型描述")
    private String vehicleTypeDesc;

    @Schema(name = "expireTime", description = "过期时间（null表示长期有效）")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date expireTime;

    @Schema(name = "vehiclePhone", description = "车主联系电话")
    private String vehiclePhone;

    @Schema(name = "vehicleAddress", description = "车主地址或常停位置")
    private String vehicleAddress;

    @Schema(name = "ownerName", description = "车主姓名")
    private String ownerName;

    @Schema(name = "associationId", description = "关联ID（如关联用户ID、单位ID）")
    private Long associationId;

    @Schema(name = "enabled", description = "启用状态（true-启用，false-禁用）")
    private Boolean enabled;

    @Schema(name = "createTime", description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @Schema(name = "vehiclePlateColor", description = "车牌颜色")
    private String vehiclePlateColor;

    @Schema(name = "vin", description = "车辆识别代号（VIN码）")
    private String vin;

    public void setVehicleType(String vehicleType) {
        this.vehicleType = vehicleType;
        this.vehicleTypeDesc = VehicleTypeEnum.getDescByName(vehicleType);
    }
}